$(document).ready(function() {
	$(".bnt_frm").click(function() {
		var oldcard = $("#oldcard").val();
    var newcard = $("#newcard").val();
    var oldpwd = $("#oldpwd").val();
    var newpwd = $("#newpwd").val();
    var pwd = $("#pwd").val();
    if (oldcard =="") {
    	jAlert("请填写旧卡号","换卡失败","");
    	return false;
    }else if(newcard ==""){
    	jAlert("请填写新卡号","换卡失败","");
    	return false;
    }else if(oldpwd ==""){
      jAlert("请填写旧密码","换卡失败","");
      return false;
    }else if(newpwd ==""){
      jAlert("请填写新密码","换卡失败","");
      return false;
    }else if(newpwd !=pwd){
      jAlert("两次新密码不一致","换卡失败","");
      return false;
    }
		$.ajax({
           url: "index.php?go=softpos.api.ajaxHk",
           type: 'post',
           dataType: 'json',
           data:$("#frm").serialize(),
           success: function(response) {
               if (response.success == "success") {
                   jAlert(response.data,"换卡成功",function(r) {
                       if (r==true) {
                          location.reload();
                       }
                   });
               } else {
                   jAlert(response.data,"换卡失败","");
               }
           }
       });
	});
});